package testplan.entities;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

// TODO openID or independent user management?
@PersistenceCapable
public class User {
	
	public static int ROLE_PLAIN = 0;
	
	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Long key;
	@Persistent
	private String name;
	@Persistent
	private String email;
	// TODO flat user management for now, might need to add different level of user later
	// foreign key to Role
	@Persistent
	private int role;
	// foreign key to Agency
	@Persistent
	private Long agency;
	
	public User(String name, String email, int role, Long agency) {
		super();
		this.name = name;
		this.email = email;
		this.role = role;
		this.agency = agency;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public int getRole() {
		return role;
	}

	public void setRole(int role) {
		this.role = role;
	}

	public Long getAgency() {
		return agency;
	}

	public void setAgency(Long agency) {
		this.agency = agency;
	}

	public long getKey() {
		return key;
	}
	
	public void setKey(long key)
	{
		this.key = key;
	}
	
	
}
